package com.hu.system.domain;

import java.math.BigDecimal;
import java.util.Date;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.hu.system.converter.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.hu.common.annotation.Excel;
import com.hu.common.core.domain.BaseEntity;

/**
 * 采购入库对象 purchase_inbound
 *
 * @author hu
 * @date 2025-01-21
 */
public class PurchaseInbound extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 入库ID
     */
    @ExcelIgnore
    private Long inboundId;

    /**
     * SKU编码
     */
    @Excel(name = "SKU ID")
    @ExcelProperty(value = {"SKU ID"})  // 支持多列名匹配
    private String sku;

    /**
     * 产品名称（冗余字段）
     */
    @Excel(name = "产品名称")
    @ExcelProperty("产品名称")
    private String productName;

    /**
     * SKU属性
     */
    @Excel(name = "SKU属性")
    @ExcelProperty(value = {"SKU属性", "Sku属性"})  // 支持多列名匹配
    private String skuAttr;

    /**
     * SKU货号（从Excel导入或从product_info关联查询）
     */
    @Excel(name = "SKU货号")
    @ExcelProperty("SKU货号")
    private String skuCode;

    /**
     * 所属店铺ID
     */
    @ExcelIgnore
    private Long shopId;

    /**
     * 采购数量
     */
    @Excel(name = "采购数量")
    @ExcelProperty(value = "采购数量", converter = TolerantIntegerConverter.class)
    private Integer purchaseQuantity;

    /**
     * 采购金额
     */
    @Excel(name = "采购金额")
    @ExcelProperty(value = {"采购金额", "采购总金额"}, converter = TolerantBigDecimalConverter.class)  // 支持多列名匹配
    private BigDecimal purchaseAmount;

    /**
     * 单品包装费
     */
    @Excel(name = "单品包装费")
    @ExcelProperty(value = {"单品包装费", "包装费"}, converter = TolerantBigDecimalConverter.class)  // 支持多列名匹配
    private BigDecimal packageFee;

    /**
     * 产品单价（计算字段：采购金额÷采购数量+单品包装费）
     */
    @Excel(name = "产品单价")
    @ExcelProperty(value = "产品单价", converter = TolerantBigDecimalConverter.class)
    private BigDecimal unitPrice;

    /**
     * 采购日期（精确到秒）
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    @ExcelProperty(value = {"日期"}, converter = TolerantDateConverter.class)  // 支持多列名匹配
    private Date purchaseDate;

    /**
     * 物流费（导入时读取，用于产品信息，不存储到采购入库表）
     */
    @Excel(name = "物流费")
    @ExcelProperty(value = "物流费", converter = TolerantBigDecimalConverter.class)
    private BigDecimal logisticsFee;

    /**
     * 平台核价（导入时读取，用于更新产品表priceCheck字段）
     */
    @Excel(name = "核价")
    @ExcelProperty(value = {"核价", "平台核价"}, converter = TolerantBigDecimalConverter.class)  // 支持多列名匹配
    private BigDecimal priceCheck;

    /**
     * 删除标志（0正常 2删除）
     */
    @ExcelIgnore
    private String delFlag;

    /**
     * 店铺名称（从Excel导入或数据库查询）
     */
    @Excel(name = "所属店铺")
    @ExcelProperty("所属店铺")
    private String shopName;

    /**
     * 备注（从Excel导入）
     */
    @ExcelProperty(value = {"备注/原因", "备注"})  // 支持多列名匹配
    private String remark;

    public void setInboundId(Long inboundId) {
        this.inboundId = inboundId;
    }

    public Long getInboundId() {
        return inboundId;
    }

    public void setSku(String sku) {
        this.sku = sku;
    }

    public String getSku() {
        return sku;
    }

    public void setProductName(String productName) {
        this.productName = productName;
    }

    public String getProductName() {
        return productName;
    }

    public void setShopId(Long shopId) {
        this.shopId = shopId;
    }

    public Long getShopId() {
        return shopId;
    }

    public void setPurchaseQuantity(Integer purchaseQuantity) {
        this.purchaseQuantity = purchaseQuantity;
    }

    public Integer getPurchaseQuantity() {
        return purchaseQuantity;
    }

    public void setPurchaseAmount(BigDecimal purchaseAmount) {
        this.purchaseAmount = purchaseAmount;
    }

    public BigDecimal getPurchaseAmount() {
        return purchaseAmount;
    }

    public void setPackageFee(BigDecimal packageFee) {
        this.packageFee = packageFee;
    }

    public BigDecimal getPackageFee() {
        return packageFee;
    }

    public void setUnitPrice(BigDecimal unitPrice) {
        this.unitPrice = unitPrice;
    }

    public BigDecimal getUnitPrice() {
        return unitPrice;
    }

    public void setPurchaseDate(Date purchaseDate) {
        this.purchaseDate = purchaseDate;
    }

    public Date getPurchaseDate() {
        return purchaseDate;
    }

    public void setDelFlag(String delFlag) {
        this.delFlag = delFlag;
    }

    public String getDelFlag() {
        return delFlag;
    }

    public String getShopName() {
        return shopName;
    }

    public void setShopName(String shopName) {
        this.shopName = shopName;
    }

    public String getSkuAttr() {
        return skuAttr;
    }

    public void setSkuAttr(String skuAttr) {
        this.skuAttr = skuAttr;
    }

    public String getSkuCode() {
        return skuCode;
    }

    public void setSkuCode(String skuCode) {
        this.skuCode = skuCode;
    }

    public BigDecimal getLogisticsFee() {
        return logisticsFee;
    }

    public void setLogisticsFee(BigDecimal logisticsFee) {
        this.logisticsFee = logisticsFee;
    }

    public BigDecimal getPriceCheck() {
        return priceCheck;
    }

    public void setPriceCheck(BigDecimal priceCheck) {
        this.priceCheck = priceCheck;
    }

    @Override
    public String getRemark() {
        return remark;
    }

    @Override
    public void setRemark(String remark) {
        this.remark = remark;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("inboundId", getInboundId())
                .append("sku", getSku())
                .append("productName", getProductName())
                .append("skuAttr", getSkuAttr())
                .append("skuCode", getSkuCode())
                .append("shopId", getShopId())
                .append("purchaseQuantity", getPurchaseQuantity())
                .append("purchaseAmount", getPurchaseAmount())
                .append("packageFee", getPackageFee())
                .append("unitPrice", getUnitPrice())
                .append("purchaseDate", getPurchaseDate())
                .append("logisticsFee", getLogisticsFee())
                .append("priceCheck", getPriceCheck())
                .append("remark", getRemark())
                .append("delFlag", getDelFlag())
                .append("createBy", getCreateBy())
                .append("createTime", getCreateTime())
                .append("updateBy", getUpdateBy())
                .append("updateTime", getUpdateTime())
                .toString();
    }
}

